package logic

import (
	"context"
	"user_srv/internal/dao"
	"user_srv/internal/svc"
	"user_srv/user"

	"github.com/zeromicro/go-zero/core/logx"
)

type MembershipRenewalLogic struct {
	ctx    context.Context
	svcCtx *svc.ServiceContext
	logx.Logger
}

func NewMembershipRenewalLogic(ctx context.Context, svcCtx *svc.ServiceContext) *MembershipRenewalLogic {
	return &MembershipRenewalLogic{
		ctx:    ctx,
		svcCtx: svcCtx,
		Logger: logx.WithContext(ctx),
	}
}

func (l *MembershipRenewalLogic) MembershipRenewal(in *user.MembershipRenewalRequest) (*user.MembershipRenewalResponse, error) {
	renewal, s := dao.MembershipRenewal(in.Price)
	return &user.MembershipRenewalResponse{
		OrderSn: renewal, // 订单号
		Pay:     s,       // 支付链接
	}, nil
}
